package org.jprobe;

import java.util.List;

/**
*
* Settings contract
*
* @author Hussain Al-Mutawa
* @version 1.0
* @since 1.0
*/
public interface SettingsInterface {
	/**
	 * gets the last directory used by the project
	 * @return the last used workspace directory
	 */
	String getLastDirectory();
	/**
	 * gets the most preferred directory to load projects from
	 * @return the prefered directory
	 */
	String getPreferredDirectory();
	/**
	 * gets the history of the last worked on projects
	 * @return a list of the worked on projects from the history
	 */
	String[]getHistory();
	/**
	 * sets the last used directory
	 * @param directory the last workspace file location
	 */
	void setLastDirectory(String directory);
	/**
	 * sets the most preferred directory
	 * @param directory the most preferred workspace file location
	 */
	void setPreferredDirectory(String directory);
	/**
	 * adds the selected project to the history and updates the Xml file at the same time
	 * @param project the project to be added to the history
	 */
	void addProjectToHistory(String project);
	/**
	 * reads the settings from XML file, the settings have to be
	 * in the following format
	 * <pre>
	 *	&lt;settings&gt;
	 * 		&lt;lastDirectory value=""/&gt;
	 * 		&lt;preferredDirectory value=""/&gt;
	 * 		&lt;lastWorkedProjects&gt;
	 * 			&lt;project name="" path=""/&gt;
	 * 			...
	 * 		&lt;/lastWorkedProjects&gt;
	 *	&lt;/settings&gt;
	 * </pre>
	 * @param fileName the file name which contains the settings
	 * @throws JProbeException if the conversion failed, file not found,
	 * 			or the file name is incorrect/invalid
	 */
	void readSettingsFromFile(String fileName) throws JProbeException;
	/**
	 * writes the settings to the hard drive
	 * @param fileName the file name which contains the settings
	 * @throws Exception if the conversion failed, file not found,
	 * 			or the file name is incorrect/invalid
	 */
	void writeSettingsToFile(String fileName)throws JProbeException;
	/**
	 * gets the settings xml file
	 * @return the file name which contains the settings
	 */
	String getSettingsFileName();
	/**
	 * sets the history of the current workspace
	 * @param history the list of project processed so far in the history
	 */
	void setHistory(List<String> history);
}
